package com.gr.staffpm.security.service;

import java.util.List;

import org.apache.wicket.model.IModel;

import com.gr.staffpm.datatypes.Group;
import com.gr.staffpm.datatypes.Permission;
import com.gr.staffpm.datatypes.Project;
import com.gr.staffpm.datatypes.Role;
import com.gr.staffpm.datatypes.Task;
import com.gr.staffpm.datatypes.User;
import com.gr.staffpm.projects.model.ProjectPermission;
import com.gr.staffpm.security.constants.CRUDProjectPermission;
import com.gr.staffpm.security.constants.CRUDTaskPermission;

/**
 * A service interface for accessing and modifying user data in the system.
 */
public interface UserService {

    User getCurrentUser();

    void createUser(String username, String email, String password);

    List<User> getAllUsers();

    User getUser(int userId);

    void deleteUser(int userId);

    User findUser(String username);

    List<User> getAllUsers(int first, int count, String property, boolean ascending);

    List<User> getUsersInGroupByGroupName(String groupName, User currUser, int userLevel);

    void addOrUpdateUser(User user);

    Role getUserRole();

    void addRole(User user, String user2);

    List<Role> getAllRoles();

    void addRoles(User newUser, List<Role> defaultModelObject);

    List<Group> getAllGroups();

    boolean checkUserExists(User newUser);

    List<Role> getAllRoles(int first, int count, String property, boolean ascending);

    Role getRole(int id);

    List<Permission> getAllPermissions();

    void createOrUpdateRole(Role newRole);

    List<IModel<Role>> getAllRolesAsModels();

    void createPermission(Role role, CRUDProjectPermission permission, Project newProject);

    List<ProjectPermission> getProjectPermissions(Project project);

    void deletePermission(CRUDProjectPermission permission, Project project);

    void createPermission(Role role, CRUDTaskPermission permission, Task newTask);

    void deletePermission(CRUDTaskPermission permission, Task task);

    int getUsersHighestLevel(User user);

}
